﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp; 

namespace ClientApp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            TcpClientChannel channel = new TcpClientChannel();
        }

        private void btnGetDetail_Click(object sender, EventArgs e)
        {
            try 
            {                            
                 RemoteObject.Class1 c = (RemoteObject.Class1)Activator.GetObject(typeof(RemoteObject.Class1),"tcp://11.6.6.3:9932/RemoteObject");          
                 string account_number = txtAccNumber.Text; 
              
                if (c.TransDetail(account_number).Tables[0].Rows.Count == 0) 
                { 
                    MessageBox.Show("Khong ton tai ban ghi nao cho account nay!"); 
                } 
                else 
                { 
                    dataGrid1.DataSource = c.TransDetail(account_number).Tables[0]; 
                } 
                 
            } 
            catch (Exception) 
            { 
                MessageBox.Show("Tham chieu doi tuong khong thanh cong!"); 
            } 
        }
    }
}
